var http=require('http');
var conn=require('connect');
var saveRequest=require('./saveRequest');
var reply=require('./reply');
var writeHeader=require('./writeHeader');
var errCreator=require('./errCreator');
var errHandler=require('./errHandler');
var app=conn();

app.use('/',errCreator());
app.use('/',saveRequest(__dirname+'/requests'));
app.use('/',writeHeader('X-Powered-By','Node'));
app.use('/',reply('Hello NodeJS'));
app.use('/',errHandler());

http.createServer(app).listen(3000, function () {
    console.log('Connect port 3000 - ',new Date());
});